package com.xyy.kingdeejdy.config;

import com.smecloud.apigw.client.ApigwClient;
import com.smecloud.apigw.model.ApigwConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class ClientApiConfig {
    @Value("${kingdee.client_id}")
    private String clientId;

    @Value("${kingdee.client_secret}")
    private String clientSecret;

    @PostConstruct
    public void init() {
        ApigwConfig config = new ApigwConfig();
        //设置client_id
        config.setClientID(clientId);
        //设置client_secret
        config.setClientSecret(clientSecret);
        config.setRequestTimeout(1000 * 60);
        ApigwClient apigwClient = ApigwClient.getInstance();
        //初始化API网关客户端
        apigwClient.init(config);
    }
}
